package search;

import java.sql.SQLException;
import java.util.List;

public class SearchStyle implements Search{
    SearchMQL searchMQL=new SearchMQL();
    String sql;
    /***
     *
     * @return 返回所有菜谱
     * @throws SQLException 抛出Sql异常
     */
    @Override
    public List<Recipe> searchAll()throws SQLException{
        sql = "SELECT * FROM recipes";
        return searchMQL.mysqlSearch(sql);
    }

    /***
     *
     * @param recipe_category 菜谱类别名称
     * @return 返回该类别的菜
     * @throws SQLException
     */
    @Override
    public List<Recipe> recipes(String recipe_category) throws SQLException {
        sql = "SELECT * FROM recipes WHERE recipe_category='"+recipe_category+"'";
        return searchMQL.mysqlSearch(sql);
    }
}
